import { GCellRenderer } from "../../../../../com/mui/controls/GCellRenderer";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { CrossCopyPlayerStateData } from "./CrossCopyPlayerStateData";
import { PlayerUtil } from "../../common/util/PlayerUtil";
import { Language } from "../../../../../extend/language/Language";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Cache } from "../../../cache/Cache";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
//class CrossCopyPlayerStateItem
    
    export  class CrossCopyPlayerStateItem extends GCellRenderer
    {
        constructor()
        {
            super();
            this.initUI();
            return;
        }

        /* internal  */initUI(): void
        {
            this._catpainBm = ObjCreate.createBitmap(ImagesConst.GroupCaptainIcon, 5, 0, this);
            this._name = ObjCreate.createGTextField("", 25, 0, 150, 20, this);
            this._name.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._level = ObjCreate.createGTextField("", 175, 0, 150, 20, this);
            this._level.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._career = ObjCreate.createGTextField("", 210, 0, 150, 20, this);
            this._career.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._process = ObjCreate.createGTextField("", 245, 0, 150, 20, this);
            this._process.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._state = ObjCreate.createGTextField("--", 295, 0, 40, 20, this);
            this._readyBm = new Object /* flash.display.Bitmap */();
            this._readyBm.x = 285;
            this._readyBm.y = -8;
            this.addChild(this._readyBm);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=null;
            super.data = arg1;
            if (data) 
            {
                loc1 = data as CrossCopyPlayerStateData;
                this._name.htmlText = PlayerUtil.getProxyAndName(loc1.player);
                this._level.htmlText = Language.getStringByParam(61039, loc1.player.level);
                this._career.htmlText = PlayerUtil.getCareerHtml(loc1.player.careerEnable);
                this._process.htmlText = HTMLUtil.addColor(Cache.instance.crossGroup.entityCopyProcess(loc1.player.entityId, loc1.copyId), "#FFFF00");
                this._catpainBm.visible = loc1.isCaptain;
                if (loc1.responds) 
                {
                    this._state.visible = false;
                    this._readyBm.visible = true;
                    this._readyBm.bitmapData = loc1.ready ? GlobalClass.getBitmapData(ImagesConst.tip_right) : GlobalClass.getBitmapData(ImagesConst.tip_wrong);
                }
                else 
                {
                    this._state.visible = true;
                    this._readyBm.visible = false;
                }
            }
            return;
        }

        /* internal */ /* var */_name: GTextFiled;

        /* internal */ /* var */_level: GTextFiled;

        /* internal */ /* var */_career: GTextFiled;

        /* internal */ /* var */_process: GTextFiled;

        /* internal */ /* var */_state: GTextFiled;

        /* internal */ /* var */_catpainBm: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_readyBm: Object /* flash.display.Bitmap */;
    }
